package gui.panels;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

public class ImagePanel extends JPanel {
    
    private static final long serialVersionUID = 1L;

    Image bgimage = null;

	private Image image;

	public ImagePanel(String imagePath) {
		this(new ImageIcon(imagePath).getImage());
	}
	
	public ImagePanel(ImageIcon imageIcon) {
		this(imageIcon.getImage());
	}

	public ImagePanel(Image img) {
		this.image = img;
		Dimension size = new Dimension(img.getWidth(null), img.getHeight(null));
		setPreferredSize(size);
		setMinimumSize(size);
		setMaximumSize(size);
		setSize(size);
		setLayout(null);
	}

	public void paintComponent(Graphics g) {
		g.drawImage(image, 0, 0, null);
	}
}
